<template>
  <!-- 最受好评电影 -->
  <div class="big">
    <div class="draglist">
      <p>最受好评电影</p>
      <ul class="list">
        <!-- 电影拖动列表 -->
        <router-link
          tag="li"
          :to="`/details/${movie.movieId}`"
          v-for="movie in goodList"
          :key="movie.movieId"
        >
          <img :src="movie.poster" alt="" />
          <p class="mov-name">{{ movie.name }}</p>
        </router-link>
      </ul>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      goodList: null,
    };
  },
  created() {
    // 最受好评电影列表
    this.axios.get("index/topRatedMovies").then((re) => {
      this.goodList = re.movieList;
    });
  },
};
</script>

<style lang="scss" scoped>
.big {
  background: #fff;
  width: 100vw;
}
.draglist {
  background-color: #fff;
  width: 92vw;
  // height: 180px;
  // background-color: #77f;
  margin: 10px auto 10px;
  p {
    font-size: 14px;
    line-height: 20px;
  }
  .list {
    display: flex;
    overflow-x: auto;
    margin: 10px auto 0;
    li {
      margin-right: 11px;
      margin-bottom: 10px;
      img {
        width: 85px;
        height: 115px;
      }
      .mov-name {
        width: 80px;

        margin-top: 5px;
        font-size: 13px;

        font-weight: bold;
        overflow: hidden; /*隐藏*/
        white-space: nowrap; /*不换行*/
        text-overflow: ellipsis; /* 超出部分省略号 */
      }
    }
  }
}
</style>